﻿@*@model HRMS_Model.Examination
*@@{
    ViewBag.Title = "Examinations";
}

 <div style="">
    <table id="jqgExaminations" cellpadding="0" cellspacing="0">
    </table>
    <div id="jqgpExaminations" style="text-align: center;">
    </div>
</div>
@section JavaScript{
    <script type="text/javascript">
        $(document).ready(function () {
            $('#jqgExaminations').jqGrid({
                //url from which data should get
                url: '@Url.Action("Examinations")',
                //type of data
                datatype: 'json',
                //url access method type
                mtype: 'POST',
                //columns names
                colNames: ['Question Id', 'Question', 'OptionA', 'OptionB', 'OptionC', 'Answer', ' Isactive', 'SkillName'],
                //columns model
                colModel: [
                     { name: 'QuestionId', index: 'QuestionId', align: 'left', editable: false, width: 80 },
                    { name: 'Question', index: 'Question', align: 'left', editable: true, edittype: 'text', width: 100, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 1, colpos: 1} },
                    { name: 'OptionA', index: 'OptionA', align: 'left', editable: true, edittype: 'text', width: 100, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 1, colpos: 2} },
                    { name: 'OptionB', index: 'OptionB', align: 'left', editable: true, edittype: 'text', width: 100, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 1, colpos: 3} },
                    { name: 'OptionC', index: 'OptionC', align: 'left', editable: true, edittype: 'text', width: 100, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 2, colpos: 1} },
                    { name: 'Answer', index: 'Answer', align: 'left', editable: true, edittype: 'text', width:100, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 2, colpos: 2} },
                    { name: 'Isactive', index: 'Isactive', align: 'left', editable: true, edittype: 'text', hidden: true, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 2, colpos: 3} },
                    { name: 'SkillName', index: 'SkillName', align: 'left', hidden: true, editable: true, edittype: 'select', width: 200,
                        editoptions: { multiple: false,
                            size: 1,
                            dataUrl: '@Url.Action("GetSkills", "Examinations")',
                            buildSelect: function (data) {
                                var response = jQuery.parseJSON(data);
                                var s = '<select>';
                                if (response && response.length) {
                                    for (var i = 0, l = response.length; i < l; i++) {
                                        var ri = response[i];
                                        s += '<option value="' + ri + '">' + ri + '</option>';
                                    }
                                }
                                return s + "</select>";
                            }
                        },
                        editrules: { required: true, edithidden: true },
                        formoptions: { rowpos: 3, colpos: 1 }
                    },
                            
                ],
                //pager for grid
                pager: $('#jqgpExaminations'),
                //number of rows per page
                rowNum: 5,
                //initial sorting column
                sortname: 'QuestionId',
                //initial sorting direction
                sortorder: 'asc',
                //we want to display total record count
                viewrecords: true,
                //grid height
                height: '100%'
            });
             $('#jqgExaminations').jqGrid('navGrid', '#jqgpExaminations',
                { add: true, del: true, edit: true, search: false },
                { width: 'auto', url: '@Url.Action("UpdateExamination")' },
                { width: 'auto', url: '@Url.Action("InsertExamination")' },
                { width: 'auto', url: '@Url.Action("DeleteExamination")' });
        });
    </script>
}
@section PageDescription{
    <h1>
        Examination</h1>
    <h3>
        Examination details</h3>
    <p> 
          Includes questions with three different options including questionid and a correct answer .</p>
}